#include<stdio.h>
int main()
{
	int k,a,b,i,a1,b1,h,s,cnt,s1,s2;
	scanf("%d",&k);
	while(k--){
		scanf("%d %d",&a,&b);
		cnt=1;
		s=0;
		s1=1;
		s2=1;
		for(i=10;;i*=10){
			if(a/i>0){
				s1++;
			}else{
				break;
			}
		}
		for(i=10;;i*=10){
			if(b/i>0){
				s2++;
			}else{
				break;
			}
		}
		for(i=1;i<=s1||i<=s2;i++){
			a1=a%10;
			a/=10;
			b1=b%10;
			b/=10;
			h=a1+b1;
			if(h>9){
				h=h%10;
			}
			s+=h*cnt;	
			cnt*=10;	
		}
		printf("%d\n",s);
	}
}
